import React, { Component } from 'react';
import store from '../store/index'

class ReduxPage extends Component {
    componentDidMount(){
        store.subscribe(()=>{
            console.log('state发生改变了');
            // 页面强制刷新
            this.forceUpdate()
        })
    }
    render() {
        console.log(store);
        return (
            <div>
                <h3> ReduxPage </h3>
                <p> { store.getState() } </p>
                <button onClick={() => store.dispatch({ type: 'ADD' })}>add</button>
            </div>
        );
    }
}

export default ReduxPage;